/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-03-22 17:21:42
 * @LastEditors: voanit
 * @LastEditTime: 2022-03-22 18:38:35
 */
import axios from 'axios'
import { CHANNEL_NEWS } from '../actionTypes'
export const newsActive = (id) => {
  return async (dispatch) => {
    console.log(22)
    /* 发送异步请求 */
    const res = await axios.get(
      `http://geek.itheima.net/v1_0/articles?channel_id=${id}&timestamp=${Date.now()}`
    )
    console.log(res, 678)

    await dispatch({
      type: CHANNEL_NEWS,
      payload: res.data.data.results,
    })
  }
}
